package 类和对象;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-06-19
 * Time: 10:40
 */
class Date{
    //成员变量
    public int year;
    public int month;
    public int day;
    //成员方法
    public void setDay(int year,int month,int day){
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public void printDay(){
        System.out.println(this.year+"/"+this.month+"/"+this.day);
    }
}
public class Test1 {
    public static void main(String[] args) {
        Date date1 = new Date();
        date1.printDay();//成员变量是有默认值的
        date1.setDay(2022,6,19);//调用成员方法
        date1.printDay();
    }
}
